<script setup lang="ts">
import type { Widgets } from '../types'
import InputWidget from './widgets/InputWidget.vue'
import SelectWidget from './widgets/SelectWidget.vue'

interface IEmit {
  (e: 'search'): void
}

interface IProps {
  widget: Widgets
}

defineProps<IProps>()
const emit = defineEmits<IEmit>()

function onSearch() {
  emit('search')
}
</script>

<template>
  <popover-wrapper>
    <input-widget
      v-if="widget.type === 'input'"
      :config="widget"
      @search="onSearch"
    />
    <select-widget
      v-if="widget.type === 'select'"
      :config="widget"
      @search="onSearch"
    />
  </popover-wrapper>
</template>

<style scoped lang="less"></style>
